home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11964 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: solon.com!not-for-mail
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c,comp.lang.c.moderated
  4. Subject: Re: const pointer confusion...
  5. Date: 27 Mar 1996 17:57:37 -0600
  6. Organization: none
  7. Sender: clc@solutions.solon.com
  8. Approved: clc@solutions.solon.com
  9. Message-ID: <4jcklh$9u3@solutions.solon.com>
  10. References: <4j06gm$7oa@solutions.solon.com> <4j41hs$nku@solutions.solon.com> <4j6354$3ge@solutions.solon.com> <4ja3uf$pe8@solutions.solon.com>
  11. Reply-To: fred@genesis.demon.co.uk
  12. NNTP-Posting-Host: solutions.solon.com
  13. X-NNTP-Posting-Host: genesis.demon.co.uk
  14. X-Newsreader: Demon Internet Simple News v1.27
  15. X-Mail2News-Path: genesis.demon.co.uk
  16.  
  17. In article <4ja3uf$pe8@solutions.solon.com>
  18.            c2a192@ugrad.cs.ubc.ca "Kazimir Kylheku" writes:
  19.  
  20. >In article <4j6354$3ge@solutions.solon.com>,
  21. >Kurt Watzka <watzka@stat.uni-muenchen.de> wrote:
  22. > >AFAIK, "const int const *p;" _indeed is_ a syntax error.
  23. >
  24. >No. It is a semantic error that some compilers will warn about.
  25.  
  26. Still wrong! :-)
  27.  
  28. It is a constraint violation which the compiler must diagnose.
  29.  
  30. 6.5.3 constraints:
  31.  
  32. "The same type qualifier shall not appear more than once in the same
  33.  specifier list or qualifier list, either directly or via one or more
  34.  typedefs."
  35.  
  36. >A the
  37. >duplicate type qualifier isn't a problem, but it could indicate that the
  38. >programmer intended to do something else.
  39. >
  40. >Your compiler is producing a misleading diagnostic. There is no invalid type
  41. >combination here. The error is one of a redunant ``const'', which is not
  42. >forbidden by the C language.
  43.  
  44. The compiler is correct.
  45.  
  46. -- 
  47. -----------------------------------------
  48. Lawrence Kirby | fred@genesis.demon.co.uk
  49. Wilts, England | 70734.126@compuserve.com
  50. -----------------------------------------
  51.